<?php
//完成批量注册功能
//不能直接访问数据库
//也没有部分直接去修改别人的程序
$users = file_get_contents('users.txt');
$users = preg_split('#\r\n#',$users);
//echo $users[0];
foreach ($users as $user){
    $user = preg_split('!\t!',$user);
    $context = stream_context_create(['http' => [
        'method' => 'POST',
        'header' => 'Content-type: application/x-www-form-urlencoded',
        'content' => http_build_query([//POST方法提交的数据
            'xh' => $user[0],
            'name' => $user[1],
            'tel' => '66666666666',
            'pwd' => '1!Q',
            'pwd2' => '1!Q',
        ]),
    ]]);
    $html = file_get_contents('http://localhost/modify.php',false,$context);
    echo "$user[0]\t$user[1]\n";
}
